﻿using System.Text.Json.Serialization;

namespace SourceGeneratorDemo
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
    public class AugmentAttribute : Attribute
    {
        // 特性的成员
        public string Description { get; set; }
        // 特性的成员
        public string userType { get; set; }

        public AugmentAttribute(string description)
        {
            Description = description;
        }

        // 构造函数
        public AugmentAttribute(string description, string userType)
        {
            Description = description;
            this.userType = userType;
        }
    }

    public interface IAugmentClass
    {

    }


    public class BaseAugmentClass
    {

    }

    [Augment("AugmentDescription")]
    public partial class AugmentClass : BaseAugmentClass, IAugmentClass
    {
        [Augment("AugmentId","userType")]
        [JsonPropertyName("JsonId")]
        public int Id { get; set; }

        public void AugmentMethod()
        {
            // 调用代码生成器中的方法
            //AugmentClassData.GeneratedMethod();
        }

    }
}
